<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改库存')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-sale-edit" th:object="${tInventory}">
        <input id="inventory" name="inventory" th:value="*{id}"  type="hidden">
        <input name="deptId"  type="hidden"  th:field="*{deptId}" id="treeId"/>
        <input name="indate"  type="hidden"  th:field="*{indate}"/>
        <input name="category" th:field="*{category}" class="form-control" type="hidden">
        <input name="variety" th:field="*{variety}" class="form-control" type="hidden">

        <div class="form-group">
            <label class="col-sm-3 control-label">条形码：</label>
            <div class="col-sm-8">
                <input id="barcode" name="barcode" th:field="*{barcode}" class="form-control" type="text" readonly="true">
            </div>
        </div>
        <div class="form-group">
        <label class="col-sm-3 control-label">饰品名称：</label>
        <div class="col-sm-8">
            <input id="name" name="name" th:field="*{name}" class="form-control" type="text" readonly="true">
        </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">门店：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input name="deptName" id="treeName" type="text" placeholder="请选择归属部门" class="form-control" th:field="*{deptName}" required readonly="true">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">品类：</label>
            <div class="col-sm-8">
                <input th:value="*{categoryName}" class="form-control" type="text" readonly="true">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">品种：</label>
            <div class="col-sm-8">
                <input th:value="*{varietyName}" class="form-control" type="text" readonly="true">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">重量(g)：</label>
            <div class="col-sm-8">
                <input id="weight" name="weight" th:field="*{weight}" class="form-control" type="text" readonly="true">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">标签价格：</label>
            <div class="col-sm-8">
                <input id="labelprice" name="labelprice" th:field="*{labelprice}" class="form-control" type="text" readonly="true">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">销售员：</label>
            <div class="col-sm-8">
                <select name="salesman" class="form-control" required>
                    <option th:each="user:${sysUsers}" th:value="${user.userName}" th:text="${user.userName}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">实收金额：</label>
            <div class="col-sm-8">
                <input id="saleprice" name="saleprice" class="form-control" type="text" required>
            </div>
        </div>

    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
    var prefix = ctx + "system/tInventory";
    $("#form-tInventory-edit").validate({
        rules:{
            xxxx:{
                required:true,
            },
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/sale", $('#form-sale-edit').serialize());
        }
    }
    /*用户管理-修改-选择部门树*/
    function selectDeptTree() {
        var deptId = $.common.isEmpty($("#treeId").val()) ? "100" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        if ($.tree.notAllowParents(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }

</script>
</body>
</html>
